home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 5
/
PC World Interactive 5.iso
/
online
/
wopr602.exe
/
SETUP.MST
< prev
next >
Wrap
Text File
|
1994-02-27
|
8KB
|
244 lines
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'' This lets us add progman items
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
''Dialog ID's
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST MODELESS = 5000
CONST BADPATH = 6400
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
'' Display the logo bitmap
SetBitmap CUIDLL$, 1
'' read the .INF file
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
ReadInfFile szInf$
'' query user for location to install to
DEST$="c:\rats" ''default destination
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("WordStartupDir")
DOTDEST$ = GetSymbolValue("EditTextOut")
WINBREAK$ = GetSymbolValue("WinBreakPath")
ADBOOK$ = GetSymbolValue("AdbkPath")
IN_TBEDIT$ = GetSymbolValue("IN_TBEDIT")
IN_WOPRFILE$ = GetSymbolValue("IN_WOPRFILE")
IN_SPELLER$ = GetSymbolValue("IN_SPELLER")
IN_WINBREAK$ = GetSymbolValue("IN_WINBREAK")
IN_WOPR$ = GetSymbolValue("IN_WOPR")
IN_ADBK$ = GetSymbolValue("IN_ADBK")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DOTDEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
GOTO GETPATHL1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
'' specify which files from .INF file should get copied
SrcDir$ = GetSymbolValue("STF_SRCDIR")
'' Get the applications
IF IN_TBEDIT$ = "Y" OR IN_WOPRFILE$ = "Y" OR IN_SPELLER$ = "Y" THEN
AddSectionFilesToCopyList "WOPR6DLL", SrcDir$, GetWindowsSysDir()
ENDIF
IF IN_TBEDIT$ = "Y" THEN
AddSectionFilesToCopyList "WOPR6TBED", SrcDir$, DEST$
ENDIF
IF IN_WOPRFILE$ = "Y" THEN
AddSectionFilesToCopyList "WOPR6FILE", SrcDir$, DEST$
ENDIF
IF IN_SPELLER$ = "Y" THEN
AddSectionFilesToCopyList "WOPR6SPELL", SrcDir$, DEST$
ENDIF
IF IN_WINBREAK$ = "Y" THEN
AddSectionFilesToCopyList "WinBreak", SrcDir$, WINBREAK$
ENDIF
IF IN_ADBK$ = "Y" THEN
AddSectionFilesToCopyList "ADBOOK", SrcDir$, ADBOOK$
ENDIF
IF IN_WOPR$ = "Y" THEN
AddSectionFilesToCopyList "WOPR6-DOT", SrcDir$, DOTDEST$
AddSectionFilesToCopyList "WOPR6-DLL", SrcDir$, DOTDEST$
AddSectionFilesToCopyList "WOPR6-WLL", SrcDir$, DEST$
ENDIF
'' Get the support DLL's
'' Clean out any old copies of the DLLs hanging around elsewhere
MakeListFromSectionFilename "filenames","WOPR6DLL"
nnames%=GetListLength("filenames")
FOR cur%=1 to nnames% STEP 1
f$=GetListItem("filenames",cur%)
win_exist%=DoesFileExist(GetWindowsDir()+f$,femExists)
sys_exist%=DoesFileExist(GetWindowsSysDir()+f$,femExists)
IF (win_exist%=1 AND sys_exist%<>1) THEN
''copy to file from \windows dir to \windows\system
CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
ELSEIF (win_exist%=1 AND sys_exist%=1) THEN
win_ver$=GetVersionOfFile(GetWindowsDir()+f$)
sys_ver$=GetVersionOfFile(GetWindowsSysDir()+f$)
IF win_ver$>sys_ver$ THEN
''copy to file from \windows dir to \windows\system
CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
END IF
IF win_ver$=sys_ver$ THEN
''copy to file from \windows dir to \windows\system
CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
END IF
IF win_ver$<sys_ver$ THEN
''delete file from \windows dir
RemoveFile GetWindowsDir()+f$,cmoForce
END IF
END IF
NEXT cur%
'' Make sure there is available disk space
'' First param is just left as "extra", because we are not
'' expanding any existing files (i.e. adding a K or two to the
'' WIN.INI file. If you use this, add an "Extra" symbol to
'' the symbol table created by AddListitem.
'' Second Parameter identifies a symbol table that the
'' GetCopyListCost function will create for how much space
'' is used by the files to be copied to hard disk.
'' Third Parameter identifies a symbol table that the
'' GetCopyListCost function will create to identify needed
'' disk space.
lRetVal& = GetCopyListCost ( "Extra", "FileCost", "Needed" )
IF lRetVal& > 0 THEN
i% = DoMsgBox ("Insufficient Disk Space", "Setup", 0 )
ClearCopyList
GOTO GETPATH '' Try another directory
END IF
'' Display billboard. "FModelessDlgProc" is the default. The
'' last parameter is irrelevant as long as it is non-zero
'' this is because we only have one billboard.
SetCopyGaugePosition 150, 120
'' copy the files
CopyFilesInCopyList
IF IN_WINBREAK$ = "Y" THEN
CreateProgmanItem "Startup", "WinBreak", MakePath(WINBREAK$,"winbreak.exe"), "", cmoOverwrite
ENDIF
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'*************************************************************************
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION